package ace.cmp.util;

import org.apache.commons.lang3.math.NumberUtils;

/**
 * .
 * @author Caspar
 *
 */
public class AceNumberUtils {

  public static boolean isPositive(long num) {
    return NumberUtils.compare(num, 0) > 0;
  }

  public static boolean isPositiveOrZero(long num) {
    return NumberUtils.compare(num, 0) >= 0;
  }

  public static boolean isPositive(int num) {
    return NumberUtils.compare(num, 0) > 0;
  }

  public static boolean isPositiveOrZero(int num) {
    return NumberUtils.compare(num, 0) >= 0;
  }

  public static boolean isNullOrZero(Long num) {
    return num == null || NumberUtils.compare(num, 0) == 0;
  }

  public static boolean isNullOrNegativeOrZero(Long num) {
    return num == null || num.longValue() <= 0;
  }

  public static boolean isNullOrZero(Integer num) {
    return num == null || NumberUtils.compare(num, 0) == 0;
  }

  public static boolean isEquals(Long x, Long y) {
    return (x == null && y == null) || (x != null && x.equals(y));
  }

  public static boolean isEquals(Integer x, Integer y) {
    return (x == null && y == null) || (x != null && x.equals(y));
  }
}
